/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package banaanvraag.tools.lists;

import java.util.ArrayList;
import banaanvraag.tools.arrays.ByteArray;

/**
 *
 * @author Luc
 */
public class ByteArrayList extends ArrayList<Byte> {
    public ByteArrayList() {
        super();
    }
    
    public void addArray(Byte[] array) {
        int i = 0;
        while(i < array.length) {
            add(array[i]);
            i++;
        }
    }
    
    public void addArray(byte[] array) {
        addArray(ByteArray.toObjectArray(array));
    }
    
    public byte[] toByteArray() {
        byte[] ret = new byte[size()];
        int i = 0;
        while(i < size()) {
            ret[i] = get(i);
            i++;
        }
        return ret;
    }
    
    public Byte[] toByteArray(boolean toObjectArray) {
        Byte[] ret = new Byte[size()];
        int i = 0;
        while(i < size()) {
            ret[i] = get(i);
            i++;
        }
        return ret;
    }
}
